package com.iflytek.universitymanagement.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.iflytek.universitymanagement.domain.WeakCourse;
import com.iflytek.universitymanagement.domain.WeakCourseDTO;
import com.iflytek.universitymanagement.mapper.WeakCourseMapper;
import com.iflytek.universitymanagement.service.WeakCourseService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class WeakCourseServiceImpl extends ServiceImpl<WeakCourseMapper, WeakCourse> implements WeakCourseService {
    @Autowired
    private WeakCourseMapper weakCourseMapper;

    @Override
    public List<WeakCourseDTO> getWeakCourses() {
        return weakCourseMapper.getAllWeakCoursesWithNames();
    }


    @Override
    public IPage<WeakCourseDTO> selectPage(int pageNum, int pageSize) {
        QueryWrapper<WeakCourseDTO> queryWrapper = new QueryWrapper<>();
        return weakCourseMapper.selectPage((Page<Object>) new Page<>(pageNum, pageSize), queryWrapper);
    }



}
